﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZiChen.SoXunLeiPan.Common;

namespace ZiChen.SoXunLeiPan.ViewModel
{
    public partial class PanUrlList : BaseViewModel
    {
        public string PanClass { get; set; } = null!;

        public string PanMd5Id { get; set; } = null!;

        public string PanUrl { get; set; } = null!;

        public string PanShare { get; set; } = null!;

        public string? PanPass { get; set; }

        public string PanTitle { get; set; } = null!;
        public string elseTitle { get; set; } = null!;

        public string? PanPath { get; set; }

        public string? PanInfo { get; set; }

        public long PanSize { get; set; }
        public string Size
        {
            get
            {
                return HelpCode.ByteToString(PanSize);
            }
        }
        public string PanExt { get; set; } = null!;
        public string elseExt { get; set; } = null;
        public string Icon
        {
            get
            {
                if (PanExt == ".folder") return "folder.svg";

                var ext = PanExt.Trim().ToLower().TrimStart('.');

                return ext switch
                {
                    "mp4" or "mkv" or "avi" or "mov" or "wmv" or "flv" or "mpeg" or "mpg" or "m4v" or "ts" or "m2ts" or "rm" or "rmvb" or "3gp" or "webm" or "vob"
                        => "video.svg",
                    "mp3" or "flac" or "wav" or "aac" or "m4a" or "wma" or "ogg" or "oga" or "ape" or "alac" or "ac3" or "dts" or "mka"
                        => "music.svg",
                    "doc" or "docx"
                        => "word.svg",
                    "pdf"
                        => "pdf.svg",
                    "ppt" or "pptx"
                        => "ppt.svg",
                    "xls" or "xlsx"
                         => "exel.svg",
                    "epub" or "mobi" or "azw3"
                        => "office",
                    "zip" or "rar" or "7z" or "tar" or "gz" or "bz2" or "xz" or "001" or "z01" or "iso"
                        => "zip.svg",
                    "torrent"
                        => "bt.svg",
                    _ => "office.svg"
                };
            }
        }
        public int PanAudit { get; set; }

        public int HitNum { get; set; }
        public DateTime PanShareDate { get; set; }
        public string Date { 
            get
            {
                return PanShareDate.ToString("yyyy/MM/dd");
            }
        }
        public string Format
        {
            get
            {
                return $"{elseExt} · {Size} · {Date}";
            }
        }
        
    }

}
